package com.devicemantra.coordinate.ds.tests;
import com.devicemantra.coordinate.dataobjects.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import com.devicemantra.coordinate.dataobjects.CDepartmentFactory;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@SuppressWarnings("serial")
public class TestViewSubDepartment extends HttpServlet 
{
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException 
	{
		resp.setContentType("text/html");
		/* First let us populate a list of Department objects */
		List<SubDepartment> lSubDeptList = SubDepartmentFactory.getAllSubDepartments();
		for(int counter = 0; counter < lSubDeptList.size(); counter++)
		{
			SubDepartment lSubDept = lSubDeptList.get(counter);
			resp.getOutputStream().println("Sub Department name is " + lSubDept.getSubDepartmentName() );
			resp.getOutputStream().println("---[OWNED BY] ----> " + lSubDept.getParentDepartment().getDepartmentName() + "<BR>");
			
		}
	}
}

